<?php echo View::factory('admin/advert/advert_left')->set('catalog_tree', $catalog_tree)->render(); ?>
<script type="text/javascript" src="/media/js/my_validation.js"></script>
<link href="/media/js/uploadify/uploadify.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="/media/js/uploadify/swfobject.js"></script>
<script type="text/javascript" src="/media/js/uploadify/jquery.uploadify.v2.1.4.min.js"></script>

<script>        
    $(document).ready(function() {
        $( ".format2" ).buttonset();
        
        $('.delete').click(function() {
            var del = this;
            deletenotice = "您确定要删除<font color='#FF0084'>" +$('#advid-'+$(del).text()).text() +"</font>吗？";
            $('#delete-notice').html(deletenotice);
            $( "#dialog:ui-dialog" ).dialog( "destroy" );
            $( "#dialog-confirm" ).dialog({
                resizable: false,
                height:140,
                modal: true,
                buttons: {
                    "确定": function() {
                        $( this ).dialog( "close" );
                        var deleteurl = "/admin/adv/delete/"+$(del).text();
                        window.location.href=deleteurl;
                    },
                    "取消": function() {
                        $( this ).dialog( "close" );
                    }
                }
            });
            return false;
        });
        
        
    
        
        $('#delete-all-submit').button();
        
        
        $( ".delete" ).button({
            icons: {
                primary: "ui-icon ui-icon-trash"
            },
            text: false
        });
        $( ".edit" ).button({
            icons: {
                primary: "ui-icon ui-icon-pencil"
            },
            text: false
        });
        $('#add').button({
            icons:{
                primary:"ui-icon ui-icon-plusthick"
            },
            text:true
        });

        
        $('#custom_file_upload').uploadify({
            'uploader'       : '/media/js/uploadify/uploadify.swf',
            'script'         : '/media/js/uploadify/uploadify.php',
            'cancelImg'      : '/media/js/uploadify/cancel.png',
            'folder'         : '/uploads',
            'multi'          : true,
            'auto'           : true,
            'fileExt'        : '*.jpg;*.gif;*.png',
            'fileDesc'       : 'Image Files (.JPG, .GIF, .PNG)',
            'queueID'        : 'custom-queue',
            'queueSizeLimit' : 300,
            'simUploadLimit' : 2,
            'removeCompleted': true,
            'displayData'   : 'shown',
            'onSelectOnce'   : function(event,data) {
                $('#status-message').text(data.filesSelected + ' files have been added to the queue.');
            },
            'onAllComplete'  : function(event,data) {
                $('#status-message').text(data.filesUploaded + ' files uploaded, ' + data.errors + ' errors.');
            }
        });	
        
        
        
        $('.archives_cat li').mousemove(function() {
            $('.onhover').removeClass('onhover');
            $(this).addClass('onhover');
        });
        $('.archives_cat li').mouseout(function() {
            $('.onhover').removeClass('onhover');
            
        });
    });
</script>
<div id="dialog-confirm" title="友情提醒" style="display: none">
    <p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span><span id="delete-notice">您确定要删除该条广告吗？</span></p>
</div>
<style>
    
    .archives_cat span {float: right;white-space: normal;margin: 2px; }
    .archives_cat .advnamecolor{color:#666666;padding-left: 20px;padding-top: 3px;}
    .archives_cat ul li span a{padding:0px;}
    #add_advs {float: right;padding-right: 9px;}
    .archives_cat ul li .advsname { float: left; }
</style>


<div id="do_right" class="catalog_right">
    <div class="box" style="overflow:hidden;">
        <h3 id="h3_left">广告列表</h3>
        <div id="add_advs"><a href="/admin/adv/add"><button id="add">添加广告</button></a></div>
        <div class="clear"></div>
         
        <div class="archives_cat">
            <form action="/admin/adv/delete_all/" name="newslistform" method="post" >
            <ul >
                <?php if (is_array($data)): $i = 0; ?>
                    <?php foreach ($data as $key => $result): ?>
                        <li <?php if ( ++$i == 1): ?>class="lastlist"<?php endif ?>>
                            <span class="advsname"><span id="advid-<?php echo $result->chr_advsid ?>" class="advnamecolor"><?php echo $result->chr_advname; ?></span>&nbsp;
                              <span class="format2"  >  <input type="checkbox" id="check<?php echo $result->chr_advsid;?>" /><label for="check<?php echo $result->chr_advsid;?>"><?php echo $result->chr_advsid; ?></label></span>
                                &nbsp;</span>
                            <span>
                                <a href="/admin/adv/edit/<?php echo $result->chr_advsid ?>"><button class="edit" type="button">编辑</button></a><a href="#" ><button class="delete"><?php echo $result->chr_advsid ?></button></a>
                            </span>
                        </li>
                    <?php endforeach ?>               
                <?php endif ?>
            </ul>
                <input type="submit" name="deletealls" value="删除" id="delete-all-submit" style="margin-left: 30px;"/>
           
             </form>
            <?php echo $page_view;?>
        </div>
            
    </div>
</div>
